package com.woniuxy.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.Version;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@Data
//@AllArgsConstructor
@NoArgsConstructor
public class TBlog {
    public TBlog(Long id, String title, String author, Date publishDate, String content) {
        this.id = id;
        this.title = title;
        this.author = author;
        this.publishDate = publishDate;
        this.content = content;
    }

    private Long id;
    private String title;
    private String author;
    private Date publishDate;
    private String content;
    //逻辑删除字段
    @TableLogic(value = "0",delval = "1")//1表示已经删除 0表示没有删除
    private Integer deleted=0;

    @Version //这个字段用于版本控制
    private Integer version=0;


    @TableField(fill = FieldFill.INSERT)//在插入操作的时候填充
    private Date createTime;//创建时间
    @TableField(fill = FieldFill.INSERT_UPDATE)//在插入和更新时填充
    private Date updateTime;//更新时间



}
